function ajax(params){
//	params = {url, type, contentType, isAsync, data, success, error}
	var type = params.type == undefined ? "POST" : params.type;
	var loadingIndex;
	$.ajax({
		url: params.url,
		type: type,
		async: params.async,
		processData: params.processData,
		contentType: params.contentType,
		dataType: params.dataType,
		data: params.data,
		beforeSend:function(){
			loadingIndex = layer.open({
			    type: 2,
			    shadeClose: false
			  });
		},
		success:function(res){
			if(res.success){
				params.success(res);
			}else{
				if(res.message == "not vip"){
					layer.open({
					    content: "您还不是会员",
					    skin: 'msg',
					    time: 2,
					    end:function(){
					    	window.location.href = "register.html";
					    }
					  });
					
				}else if(res.message == "TIME_OUT"){
					layer.open({
					    content: "登录超时",
					    skin: 'msg',
					    time: 2,
					    end:function(){
					    	var url = window.location.href;
					    	window.location.href = "wechat/authorize.do?callback=" + url;
					    }
					  });
				}else{
					alertMsg(res.message);
				}
			}
		},
		complete:function(res, status){
			layer.close(loadingIndex);
		},
		error:function(res){
			var obj = eval('(' + res.responseText + ')');
			alertMsg(obj.message);
		}
	});
}